<template>
  <div class="assessment-guide-container">
    <!-- 背景装饰 -->
    <div class="background-decoration">
      <div class="decoration-circle circle-1"></div>
      <div class="decoration-circle circle-2"></div>
      <div class="decoration-circle circle-3"></div>
    </div>

    <!-- 主要内容区 -->
    <div class="guide-content">
      <!-- 头部图标和标题 -->
      <div class="guide-header">
        <div class="icon-container">
          <i class="el-icon-heart-fill"></i>
        </div>
        <h1 class="guide-title">心灵体检</h1>
        <p class="guide-subtitle">了解自己，关爱自己</p>
      </div>

      <!-- 欢迎内容 -->
      <div class="welcome-content">
        <div class="greeting">
          <h2>亲爱的同学，你们好：</h2>
        </div>

        <div class="intro-text">
          <p>
            现在我们有一个小小的<span class="highlight">"心灵体检"</span>需要大家完成。目的不是给你贴标签，而是想为你提供一面镜子，帮助你更清晰地看见自己近期的情绪和压力水平。请你像翻阅自己的日记一样，诚实地面对每一个选项。你的所有感受都值得被认真对待。
          </p>
        </div>

        <!-- 重要提示 -->
        <div class="important-tips">
          <h3>你还需要知道的是：</h3>
          <div class="tips-list">
            <div class="tip-item">
              <div class="tip-icon">
                <i class="el-icon-check"></i>
              </div>
              <span>这不是测试，没有正确或错误答案。</span>
            </div>
            <div class="tip-item">
              <div class="tip-icon">
                <i class="el-icon-time"></i>
              </div>
              <span>请根据你的真实感受，尽可能快速地作答。</span>
            </div>
            <div class="tip-item">
              <div class="tip-icon">
                <i class="el-icon-lock"></i>
              </div>
              <span>你的所有回答都会是秘密，只有心理老师会看，用来设计更多好玩的活动来帮助大家，所以请完全放心。</span>
            </div>
          </div>
        </div>

        <!-- 准备开始 -->
        <div class="ready-section">
          <p class="ready-text">准备好了吗？请开始吧！</p>
          <div class="action-buttons">
            <el-button 
              type="primary" 
              size="large" 
              @click="startAssessment"
              class="start-button"
            >
              <i class="el-icon-right"></i>
              开始测评
            </el-button>
            <el-button 
              size="large" 
              @click="goBack"
              class="back-button"
            >
              <i class="el-icon-back"></i>
              返回
            </el-button>
          </div>
        </div>
      </div>
    </div>

    <!-- 底部装饰 -->
    <div class="footer-decoration">
      <div class="wave-line"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AssessmentGuide',
  data() {
    return {
      taskInfo: null
    }
  },
  
  mounted() {
    // 获取路由参数中的任务信息
    this.taskInfo = {
      id: this.$route.query.id,
      scaleIds: this.$route.query.scaleId,
      taskName: this.$route.query.taskName || '心理健康测评'
    }
    
    console.log('测评引导页面初始化，任务信息:', this.taskInfo)
  },
  
  methods: {
    // 开始测评
    startAssessment() {
      if (!this.taskInfo.id || !this.taskInfo.scaleIds) {
        this.$message.error('任务信息不完整，无法开始测评')
        return
      }
      
      // 跳转到正式的测评页面
      const url = `/questionnaire?scaleId=${this.taskInfo.scaleIds}&id=${this.taskInfo.id}`
      window.location.href = url
    },
    
    // 返回上一页
    goBack() {
      this.$router.go(-1)
    }
  }
}
</script>

<style scoped>
.assessment-guide-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* 背景装饰 */
.background-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.decoration-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 6s ease-in-out infinite;
}

.circle-1 {
  width: 200px;
  height: 200px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.circle-2 {
  width: 150px;
  height: 150px;
  top: 60%;
  right: 15%;
  animation-delay: 2s;
}

.circle-3 {
  width: 100px;
  height: 100px;
  top: 30%;
  right: 30%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 1;
  }
}

/* 主要内容 */
.guide-content {
  max-width: 800px;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
  animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 头部 */
.guide-header {
  text-align: center;
  margin-bottom: 40px;
}

.icon-container {
  width: 80px;
  height: 80px;
  background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
  }
  50% {
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.6);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
  }
}

.icon-container i {
  font-size: 36px;
  color: white;
}

.guide-title {
  font-size: 32px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 10px 0;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.guide-subtitle {
  font-size: 16px;
  color: #7f8c8d;
  margin: 0;
}

/* 欢迎内容 */
.welcome-content {
  line-height: 1.8;
}

.greeting h2 {
  font-size: 24px;
  color: #2c3e50;
  margin: 0 0 20px 0;
  text-align: center;
  font-weight: 600;
}

.intro-text p {
  font-size: 16px;
  color: #34495e;
  text-align: justify;
  text-indent: 2em;
  margin: 0 0 30px 0;
  line-height: 1.8;
}

.highlight {
  color: #e74c3c;
  font-weight: 600;
  background: linear-gradient(120deg, rgba(231, 76, 60, 0.1) 0%, rgba(231, 76, 60, 0.2) 100%);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 重要提示 */
.important-tips {
  background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 25px;
  margin: 30px 0;
  border-left: 4px solid #667eea;
}

.important-tips h3 {
  font-size: 18px;
  color: #2c3e50;
  margin: 0 0 20px 0;
  font-weight: 600;
}

.tips-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tip-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(45deg, #52c41a, #73d13d);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.tip-icon i {
  font-size: 12px;
  color: white;
}

.tip-item span {
  font-size: 15px;
  color: #34495e;
  line-height: 1.6;
}

/* 准备开始部分 */
.ready-section {
  text-align: center;
  margin-top: 40px;
}

.ready-text {
  font-size: 18px;
  color: #2c3e50;
  margin: 0 0 30px 0;
  font-weight: 600;
}

.action-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.start-button {
  background: linear-gradient(45deg, #667eea, #764ba2);
  border: none;
  padding: 15px 40px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 25px;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.start-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.back-button {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  color: #6c757d;
  padding: 13px 30px;
  font-size: 16px;
  border-radius: 25px;
  transition: all 0.3s ease;
}

.back-button:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #495057;
  transform: translateY(-2px);
}

/* 底部装饰 */
.footer-decoration {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  z-index: 1;
}

.wave-line {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.1) 25%, 
    rgba(255, 255, 255, 0.2) 50%, 
    rgba(255, 255, 255, 0.1) 75%, 
    transparent 100%
  );
  animation: wave 3s linear infinite;
}

@keyframes wave {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .assessment-guide-container {
    padding: 15px;
  }
  
  .guide-content {
    padding: 25px 20px;
  }
  
  .guide-title {
    font-size: 28px;
  }
  
  .greeting h2 {
    font-size: 20px;
  }
  
  .intro-text p {
    font-size: 15px;
    text-indent: 1.5em;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .start-button,
  .back-button {
    width: 200px;
  }
  
  .decoration-circle {
    display: none;
  }
}

@media (max-width: 480px) {
  .guide-content {
    padding: 20px 15px;
  }
  
  .icon-container {
    width: 60px;
    height: 60px;
  }
  
  .icon-container i {
    font-size: 28px;
  }
  
  .guide-title {
    font-size: 24px;
  }
  
  .important-tips {
    padding: 20px 15px;
  }
  
  .tip-item {
    gap: 10px;
  }
}
</style>